Crate nickel_lang_core

source ·

Modules

  • Source cache.
  • Deserialization of an evaluated program to plain Rust types.
  • In this module, you have the main structures used in the destructuring feature of nickel. Also, there are implementation managing the generation of a contract from a pattern.
  • An environment for storing variables with scopes.
  • Error types and error reporting.
  • Evaluation of a Nickel term.
  • Define the type of an identifier.
  • Define the type of labels.
  • Define types of positions and position spans.
  • Program handling, from file reading to evaluation.
  • The Nickel REPL.
  • Serialization of an evaluated program to various data format.
  • Load the Nickel standard library in strings at compile-time.
  • AST of a Nickel expression.
  • Various post transformations of nickel code.
  • Typechecking and type inference.
  • Define the Nickel type system.

Macros

  • Allows to match on SharedTerm without taking ownership of the matched part until the match. In the else clause, we haven’t taken ownership yet, so we can still use the richterm at that point.
  • Multi-ary application for types implementing Into<RichTerm>.
  • Array for types implementing Into<RichTerm> (for elements). The array’s attributes are a trailing (optional) ArrayAttrs, separated by a ;. mk_array!(Term::Num(42)) corresponds to \[42\]. Here the attributes are ArrayAttrs::default(), though the evaluated array may have different attributes.
  • Multi argument function for types implementing Into<Ident> (for the identifiers), and Into<RichTerm> for the body.
  • Switch for types implementing Into<Ident> (for patterns) and Into<RichTerm> for the body of each case. Cases are specified as tuple, and the default case (optional) is separated by a ;: mk_switch!(format, ("Json", json_case), ("Yaml", yaml_case) ; def) corresponds to match { 'Json => json_case, 'Yaml => yaml_case, _ => def} format.
  • Multi-ary application for types implementing Into<RichTerm>.
  • Multi field record for types implementing Into<Ident> (for the identifiers), and Into<RichTerm> for the fields. Identifiers and corresponding content are specified as a tuple: mk_record!(("field1", t1), ("field2", t2)) corresponds to the record { field1 = t1; field2 = t2 }.
  • Multi-ary arrow constructor for types implementing Into<TypeWrapper>.
  • Wrapper around mk_uty_enum_row! to build an enum type from an enum row.
  • Multi-ary enum row constructor for types implementing Into<TypeWrapper>. mk_uty_enum_row!(id1, .., idn; tail) correspond to `<id1, .., idn | tail>.
  • Wrapper around mk_uty_record! to build a record type from a record row.
  • Multi-ary record row constructor for types implementing Into<TypeWrapper>. mk_uty_row!((id1, ty1), .., (idn, tyn); tail) correspond to `{id1: ty1, .., idn: tyn | tail}. The tail can be omitted, in which case the empty row is uses as a tail instead.